var BookAddPage = {
	'onUploadSucc':function(stat) {
		stat = JSON.parse(stat);
		if(stat.success == true){
			$.messager.info("文件上传成功！");
			$("#uploadArticle .t-tag").after("<i id='uploadSuccess' class='fa fa-fw fa-check-circle m-color-dark-green'></i>");
			$("#addBlogFrm #fileId").val(stat.info.fileId);
		} else {
			$.messager.error("文件上传失败！");
		}
	},
	'onFileChanged' : function(ele){
		var str = $(ele).val();
		var baseName = FilenameUtils.getBaseName(str);
		$("#addBlogFrm input[name='bookName']").val(baseName);
	},
	
	'showImg' : function(obj){
		  var f=$(obj).val();
          if(f == null || f ==undefined || f == ''){
              return false;
          }
          
          if(!/\.(?:png|jpg|bmp|gif|PNG|JPG|BMP|GIF)$/.test(f)){
        	  $.messager.error("类型必须是图片(.png|jpg|bmp|gif|PNG|JPG|BMP|GIF)");
        	  $(obj).val('');
              return false;
          }  
	},
	
	'onUploadImageSucc' : function(stat){
		stat = JSON.parse(stat);
		var imageFile = ctx + "/datum/file/fileDownload?fileId="+stat.info.fileId;
		$("#thumburlShow").attr("src", imageFile);
		$("#thumburlShow").show();
		$("#addBlogFrm #coverFileId").val(stat.info.fileId);
		
	},
	
	'saveBook' : function(){
		if ($("#addBlogFrm").formValidate()) {
			addBlogAjax.send();
		}
	},
	
	'onAddBlogSucc' : function(data, status, xhr){
		$.messager.info(data.message);
		var mWindow = MsgBox.getCurrentOpenDialogWindow();
		mWindow.bookInfoDatatable.refresh(false);
		MsgBox.closeActiveDialog();
	}
};
